เมนูนำทาง
โปรแกรมเฮลโลเวิลด์ Graphical user interfaces (GUIs)this.createTextField ("hello_txt",0,10,10,100,20) ;
this.hello_txt.text="Hello, world";
See also TUI section.
display dialog "Hello World!" buttons {"OK"} default button 1
Or to have the OS synthesize it and literally speak out the words "hello world!" (with no comma, as that would cause the synthesizer to pause)
say "Hello world!"
See also TUI section.
import System.Drawingimport System.Windows.Formsf = Form ()f.Controls.Add (Label (Text: "Hello, World!", Location: Point (40,30)))f.Controls.Add (Button (Text: "Ok", Location: Point (50, 55) , Click: {Application.Exit () }))Application.Run (f)
Functional equivalent of C# program below.
See also TUI section.
using System;using System.Drawing;using System.Windows.Forms;class HelloWorldForm : Form { public static void Main () { Application.Run (new HelloWorldForm ()) ; } public HelloWorldForm () { Label label = new Label () ; label.Text = "Hello, World!"; label.Location = new Point (40,30) ; Controls.Add (label) ; Button button = new Button () ; button.Text = "OK"; button.Location = new Point (50,55) ; Controls.Add (button) ; button.Click += new EventHandler (OnButtonOk) ; } void OnButtonOk (Object sender, EventArgs e) { Application.Exit () ; }}
or ||
using System;using System.Drawing;using System.Windows.Forms;namespace HelloWorld{ public class HelloWorld : Form { public HelloWorld () { ShowMessage () ; } [STAThread] static void Main () { Application.Run (new HelloWorld ()) ; } private void ShowMessage () { MessageBox.Show ( "Hello World!!!", "Hello World - C#", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1 ) ; } }}
#import <Cocoa/Cocoa.h>
@interface hello : NSObject {}@end@implementation hello- (void) awakeFromNib{ NSBeep () ; // we don't need this but it's conventional to beep // when you show an alert NSRunAlertPanel (@"Message from your Computer", @"Hello, world!", @"Hi!", nil, nil) ;}@end
{curl 3.0, 4.0 applet}{curl-file-attributes character-encoding = "utf-8"}Hello, world!
program Hello_World;uses Windows; begin ShowMessage ("Hello, world!") ;end.
MS-Windows only - basic.
include msgbox.eif message_box ("Hello, world!", "Hello", 0) then end if
MS-Windows only - using Win32Lib library
include win32lib.ewcreateForm ({ ";Window; Hello", ";Label; Hello, World!" })include w32start.ew
#include <fltk/Window.h>#include <fltk/Widget.h>#include <fltk/run.h>using namespace fltk; int main (int argc, char **argv){ Window *window = new Window (300, 180) ; window->begin () ; Widget *box = new Widget (20, 40, 260, 100, "Hello, World!") ; box->box (UP_BOX) ; box->labelfont (HELVETICA_BOLD_ITALIC) ; box->labelsize (36) ; box->labeltype (SHADOW_LABEL) ; window->end () ; window->show (argc, argv) ; return run () ;}
See also TUI section.
PUBLIC SUB Main () Message.Info ("Hello, world!")END
#include <iostream>#include <gtkmm/main.h>#include <gtkmm/button.h>#include <gtkmm/window.h>using namespace std;class HelloWorld : public Gtk::Window {public: HelloWorld () ; virtual ~HelloWorld () ;protected: Gtk::Button m_button; virtual void on_button_clicked () ;};HelloWorld::HelloWorld (): m_button ("Hello, world!") { set_border_width (10) ; m_button.signal_clicked ().connect (SigC::slot (*this, &HelloWorld::on_button_clicked)) ; add (m_button) ; m_button.show () ;}HelloWorld::~HelloWorld () {}void HelloWorld::on_button_clicked () { cout << "Hello, world!" << endl;}int main (int argc, char *argv[]) { Gtk::Main kit (argc, argv) ; HelloWorld helloworld; Gtk::Main::run (helloworld) ; return 0;}
from gtk import *
window = Window (WINDOW_TOPLEVEL)window.set_title ("Hello World!")window.connect ("destroy", main_quit)window.add (VBox ())window.child.pack_start (Label ("Hello World!"))button=Button ("OK")window.child.pack_end (button)button.connect ("clicked", main_quit)window.show_all ()main ()
or
import gtkgtk.MessageDialog (message_format="Hello World!").run ()
using Gtk;
using GtkSharp;using System;class Hello { static void Main () { Application.Init () ; Window window = new Window ("") ; window.DeleteEvent += cls_evn; Button close = new Button ("Hello World") ; close.Clicked += new EventHandler (cls_evn) ; window.Add (close) ; window.ShowAll () ; Application.Run () ; } static void cls_evn (object obj, EventArgs args) { Application.Quit () ; }}
include gtk2/wrapper.eInfo (NULL,"Hello","Hello World!")
See also TUI section.
import javax.swing.JOptionPane;public class Hello { public static void main (String[] args) { JOptionPane.showMessageDialog (null, "Hello, world!!") ; }}
<HTML><HEAD><TITLE>Hello World</TITLE></HEAD><BODY>HelloWorld Program says:<APPLET CODE="HelloWorld.class" WIDTH=600 HEIGHT=100></APPLET>
</BODY></HTML>
import import public class HelloWorld extends Applet { public void paint (Graphics g) { g.drawString ("Hello, world!", 100, 50) ; }}
<a href="#" onclick="alert ('Hello, world!') ; return false;">Hello World Example</a>An even easier method involves using popular browsers' support for the virtual 'javascript' protocol to execute JavaScript code. Enter the following as an Internet address (usually by pasting into the address box) :
javascript:alert ('Hello, world!') ;There are many other ways:
javascript:document.write ('Hello, world!\n') ;
This creates a window labeled "Hello world" with a button labeled "Hello world".
hello:hello..l:"Hello world"hello..c:`button`show$`hello
See also TUI section.
(On Psion Series 3 and later compatible PDAs.)
PROC guihello: ALERT ("Hello, world!","","Exit")ENDP
or
PROC hello: dINIT "Window Title" dTEXT "","Hello World" dBUTTONS "OK",13 DIALOGENDP
#include <qapplication.h>#include <qpushbutton.h>#include <qwidget.h>#include <iostream>class HelloWorld : public QWidget{ Q_OBJECTpublic: HelloWorld () ; virtual ~HelloWorld () ;public slots: void handleButtonClicked () ; QPushButton *mPushButton;};HelloWorld::HelloWorld () : QWidget () , mPushButton (new QPushButton ("Hello, World!", this)){ connect (mPushButton, SIGNAL (clicked ()) , this, SLOT (handleButtonClicked ())) ;}HelloWorld::~HelloWorld () {}void HelloWorld::handleButtonClicked (){ std::cout << "Hello, World!" << std::endl;}int main (int argc, char *argv[]){ QApplication app (argc, argv) ; HelloWorld helloWorld; app.setMainWidget (&helloWorld) ; helloWorld.show () ; return app.exec () ;}
or
#include <QApplication>#include <QPushButton>int main (int argc, char *argv[]){ QApplication app (argc, argv) ; QPushButton hello ("Hello world!") ; hello.resize (100, 30) ; hello.show () ; hello.connect (&hello, SIGNAL (clicked ()) , SLOT (close ())) ; return app.exec () ;}
See also TUI section.
(On Hewlett-Packard
Hello ()
TEXT "Hello, world!"
See also TUI section.
require 'wxruby'class HelloWorldApp < Wx::App def on_init ourFrame = Wx::Frame.new (nil, -1, "Hello, world!").show ourDialogBox = Wx::MessageDialog.new (ourFrame, "Hello, world!", "Information:", \ Wx::OK|Wx::ICON_INFORMATION).show_modal endendHelloWorldApp.new.main_loop
See also TUI section.
require 'gtk2'Gtk.initwindow = Gtk::Window.newwindow.signal_connect ("delete_event") { Gtk.main_quit; false }button = Gtk::Button.new ("Hello World")button.signal_connect ("clicked") { Gtk.main_quit; false }window.add (button)window.show_allGtk.main
import org.eclipse.swt.SWT;import org.eclipse.swt.layout.RowLayout;import org.eclipse.swt.widgets.Shell;import org.eclipse.swt.widgets.Label;public class SWTHello { public static void main (String [] args) { Display display = new Display () ; final Shell shell = new Shell (display) ; RowLayout layout = new RowLayout () ; layout.justify = true; layout.pack = true; shell.setLayout (layout) ;
See also TUI section.
label .l -text "Hello, world!"pack .l
See also TUI section.
import Tkinterr = Tkinter.Tk ()w = Tkinter.Label (r, text="Hello, world!")w.pack ()r.mainloop ()
or, more primitively:
import
Sub Main () MsgBox "Hello, world!"End Sub
#include @"pfc\vpi\vpi.ph"goal vpiCommonDialogs::note ("Hello World!").
This uses the Windows API to create a full window containing the text. Another example below uses the built-in MessageBox function instead.
#include <windows.h>LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM) ;char szClassName[] = "MainWnd";int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ HWND hwnd; MSG msg; WNDCLASSEX wincl; wincl.cbSize = sizeof (WNDCLASSEX) ; wincl.cbClsExtra = 0; wincl.cbWndExtra = 0; wincl.style = 0; wincl.hInstance = hInstance; wincl.lpszClassName = szClassName; wincl.lpszMenuName = NULL; //No menu wincl.lpfnWndProc = WindowProcedure; wincl.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1) ; //Color of the window wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; //EXE icon wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION) ; //Small program icon wincl.hCursor = LoadCursor (NULL, IDC_ARROW) ; //Cursor if (!RegisterClassEx (&wincl)) return 0; hwnd = CreateWindowEx (0, //No extended window styles szClassName, //Class name "", //Window caption WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, //Let Windows decide the left and top //positions of the window 120, 50, //Width and height of the window, NULL, NULL, hInstance, NULL) ; //Make the window visible on the screen ShowWindow (hwnd, nCmdShow) ; //Run the message loop while (GetMessage (&msg, NULL, 0, 0) >0) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam;}LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ PAINTSTRUCT ps; HDC hdc; switch (message) { case WM_PAINT: hdc = BeginPaint (hwnd, &ps) ; TextOut (hdc, 15, 3, "Hello, world!", 13) ; EndPaint (hwnd, &ps) ; break; case WM_DESTROY: PostQuitMessage (0) ; break; default: return DefWindowProc (hwnd, message, wParam, lParam) ; } return 0;}
Or, much more simply:
#include <windows.h>int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ MessageBox (NULL, "Hello, world!", "", MB_OK) ; return 0;}
<job id="HelloWorld"> <script language="VBScript"> WScript.Echo "Hello, world!" </script></job>
<job id="HelloWorld"> <script language="JScript"> WScript.Echo ( "Hello, world!" ) ; </script></job>
There are many ways to do this in XSL, the simplest being:
<xsl:template match="/"> <xsl:text>Hello, world!</xsl:text></xsl:template>
If nested similar to the HTML version, it would be:
<xsl:template match="/"> <html> <body> <h1>Hello, world!</h1> </body> </html></xsl:template>
Type the following in a text file (e.g. hello.world.xul) and then open with Mozilla Firefox.
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <box align="center" pack="center" flex="1"> <description>Hello, world</description> </box></window>
เมนูนำทาง
โปรแกรมเฮลโลเวิลด์ Graphical user interfaces (GUIs)ใกล้เคียง
โปรแกรมเฮลโลเวิลด์ โปรแกรมจัดการรหัสผ่าน โปรแกรมหน้า วิญญาณอาฆาต โปรแกรมความภักดี โปรแกรมตรวจแก้จุดบกพร่องกนู โปรแกรมป้องกันไวรัส โปรแกรมประยุกต์ โปรแกรมอรรถประโยชน์ โปรแกรมคอมพิวเตอร์ โปรแกรมประยุกต์บนเว็บแหล่งที่มา
WikiPedia: โปรแกรมเฮลโลเวิลด์ http://www.autohotkey.com http://www.php.net/ini.core#ini.short-open-tag http://www.mozilla.org/keymaster/gatekeeper/there.... http://www.w3.org/1999/xhtml http://www.w3.org/TR/html4/strict.dtd http://www.w3.org/TR/html4/struct/global.html http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd